<?php $this->load->view('layout/header');?>
<div class="supplier-content-page">
    <div class="product-test-h5">
        <ul class="breadcrumb">
            <li><a href="javascript:;">商品管理</a></li>
            <li class="active"><a href="<?php echo site_url('tourismgoodsbase/grid')?>">宝贝管理</a></li>
        </ul>
        <div class="product-view-area">
            <p>宝贝管理</p>
            <a href="<?php echo site_url('tourismgoodsbase/addstep1')?>">添加宝贝</a>
        </div>
        <?php echo execute_alert_message();?>
        <div class="order-search">
            <form method="get" action="<?php echo site_url('tourismgoodsbase/grid')?>" class="form-horizontal">
                <div class="row">
                    <div class="col-lg-4">
                        <div class="form-group">
                            <label class="col-sm-4 control-label">商品编号</label>
                            <div class="col-xs-7">
                                <input type="hidden" name="is_on_sale" value="<?php echo $this->input->get('is_on_sale');?>">
                                <input type="text" name="goods_id" value="<?php echo $this->input->get('goods_id');?>" class="form-control" placeholder="请输入商品编号" >
                            </div>
                        </div>
                    </div>
                    <div class="col-lg-4">
                        <div class="form-group">
                            <label class="col-sm-4 control-label">商品名称</label>
                            <div class="col-xs-7">
                                <input type="text" name="goods_name" value="<?php echo $this->input->get('goods_name')?>" class="form-control" placeholder="请输入产品名称">
                            </div>
                        </div>
                    </div>
                    <div class="col-lg-4">
                        <div class="form-group">
                            <label class="col-sm-4 control-label">所属分类</label>
                            <div class="col-xs-7">
                                <input type="text" value="<?php echo $this->input->get('category_name')?>" name="category_name" class="form-control" placeholder="请输入所属分类" >
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row search-button">
                    <div class="col-lg-5">
                        <div class="form-group">
                            <label class="col-sm-4 control-label"> </label>
                            <div class="col-xs-7">
                                <button type="submit" class="btn btn-warning">搜索</button>
                                <a href="<?php echo site_url('tourismgoodsbase/grid');?>" class="btn btn-default">重置条件</a>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
        </div>
        <div class="tourism-product-list">
            <div class="order-dan clearfix">
                <ul class="order-httList">
                    <li <?php if (!$this->input->get('is_check') && !$this->input->get('is_on_sale') && !$this->input->get('is_beizhu')):?>class="active"<?php endif;?>>
                        <a href="<?php echo site_url('tourismgoodsbase/grid').($urlparams ? $urlparams : '');?>">全部宝贝</a>
                    </li>
                    <li <?php if ($this->input->get('is_on_sale')==1):?>class="active"<?php endif;?>>
                        <a href="<?php echo site_url('tourismgoodsbase/grid').($urlparams ? $urlparams.'&is_on_sale=1':'?is_on_sale=1')?>">上架宝贝</a>
                    </li>
                    <li <?php if($this->input->get('is_on_sale')==2):?>class="active"<?php endif;?>>
                        <a href="<?php echo site_url('tourismgoodsbase/grid').($urlparams ? $urlparams.'&is_on_sale=2':'?is_on_sale=2')?>">下架宝贝</a>
                    </li>
                </ul>
            </div>
            <?php if ($page_list->num_rows() > 0):?>
                <table class="table">
                    <thead>
                        <tr>
                            <th>商品名称</th>
                            <th>所属分类</th>
                            <th>销售价</th>
                            <th>供应价</th>
                            <th>上下架</th>
                            <th>库存</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                    <?php foreach($page_list->result() as $item):?>
                        <tr>
                            <td class="baobei" rowspan="1">
                                <div class="tourism-goods-num">
                                    <div class="media">商品编号：<?php echo $item->goods_id; ?></div>
                                </div>
                                <div class="media">
                                    <div class="media-left">
                                        <a target="_blank" href="<?php echo $this->config->wap_base_url.'tourism/goods/info/'.$item->goods_attr_id.'.html' ?>">
                                            <img class="media-object lazy" src="skins/images/load.jpg" data-original="<?php echo $this->config->show_image_url($item->images, '300-300') ?>">
                                        </a>
                                    </div>
                                    <div class="media-body">
                                        <h4 class="media-heading"><?php echo $item->goods_name ?></h4>
                                        <span><?php echo $item->attribute_value ?></span>
                                    </div>
                                </div>
                            </td>
                            <td><?php echo $item->category_name?></td>
                            <td><strong class="text-primary">￥<?php echo $item->shop_price;?></strong></td>
                            <td><strong class="text-primary">￥<?php echo $item->supply_price?></strong></td>
                            <td><strong class="text-danger"><?php echo $item->is_on_sale==1?'已上架':'已下架'; ?></strong></td>
                            <td><?php echo $item->goods_num?></td>
                            <td class="operate-list">
                                <p>
                                    <a class="btn btn-default btn-xs" href="<?php echo site_url('tourismgoodsbase/edit/'.$item->goods_attr_id)?>">编辑</a>
                                    <a class="btn btn-info btn-xs" href="<?php echo site_url('tourismgoodsbargaining/add').'?goods_attr_id='.$item->goods_attr_id?>">议价</a>
                                </p>
                                <p>
                                   <?php if ($item->is_on_sale == 1) :?>
                                      <a class="btn btn-warning btn-xs" href="<?php echo base_url('tourismgoodsbase/upOrDown/'.$item->goods_id.'/'.$item->is_on_sale)?>" onclick="return confirm('确定要下架操作？')">下架</a>
                                   <?php elseif ($item->is_on_sale ==2) : ?>
                                      <a class="btn btn-warning btn-xs" href="<?php echo base_url('tourismgoodsbase/upOrDown/'.$item->goods_id.'/'.$item->is_on_sale)?>" onclick="return confirm('确定要上架操作？')">上架</a>
                                   <?php endif;?>
                                      <a class="btn btn-danger btn-xs" href="<?php echo base_url('tourismgoodsbase/isDelete/'.$item->goods_attr_id);?>" onclick="return confirm('确定要删除？')">删除</a>
                                </p>
                                <p>
                                    <a target="_blank" class="btn btn-success btn-xs" href="<?php echo $this->config->wap_base_url.$this->uid.'/tourism/goods/preview/'.$item->goods_attr_id.'.html'?>">预览</a>
                                </p>
                            </td>
                        </tr>
                    <?php endforeach ;?>
                    </tbody>
                </table>
                <div class="your-page pagination pagination-right"><?php echo $pg_link;?></div>
            <?php else: ?>
                <div class="none-data">暂无数据</div>
            <?php endif;?>
        </div>
    </div>
</div>
<?php $this->load->view('layout/footer');?>